const path = require('path')
const { merge } = require('webpack-merge')
const CopyWebpackPlugin = require('copy-webpack-plugin')
const { CleanWebpackPlugin } = require('clean-webpack-plugin')

const commonConfig = require('./webpack.common')

/**
 * @type { import('webpack').Configuration }
 */
const prodConfig = {
  mode: 'production',
  devtool: false,
  plugins: [
    new CleanWebpackPlugin(),
    new CopyWebpackPlugin({
      patterns: [
        {
          from: path.resolve(__dirname, 'public'),
        },
      ]
    })
  ]
}

module.exports = merge(commonConfig, prodConfig)